

import { game } from "../../../../script/game/control/game";
import { actionType } from "../../../../script/game/gameType";
import { ListItem } from "../../../../script/util/ListView/ListItem";
import { ccs } from "../../../../script/util/services";

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends ListItem<actionType> {
   
    @property(cc.Label)
    title: cc.Label = null;

    @property(cc.Label)
    desc: cc.Label = null;

    start () {

    }
    initItem(data: actionType, index: number) {
        this.title.string = data.name;
        this.desc.string = data.desc || "神秘的地方";
    }
    onItemclick(data: actionType) {
        if(!data.type){
            //如果是不需要使用物品的，直接发生
            game.playerMgr.doAction(data);
        } else {
            ccs.winMgr.showWin("popItemsWin", {id: data.type}) //使用或丢弃
        }
        
    }

}
